package com.youlu.campus.admin.english;

import com.youlu.campus.common.base.RestResult;
import com.youlu.campus.common.base.RestResultBuilder;
import com.youlu.campus.entity.english.CompetitionCarousel;
import com.youlu.campus.entity.english.CompetitionConfig;
import com.youlu.campus.service.english.CompetitionCarouselService;
import com.youlu.campus.service.english.CompetitionConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
public class CompetitionConfigController {

    @Autowired
    private CompetitionConfigService competitionConfigService;


    @Autowired
    private CompetitionCarouselService competitionCarouselService;

    @PostMapping("/activity-group/config/save")
   public RestResult save(@RequestBody CompetitionConfig competitionConfig){
        competitionConfigService.save(competitionConfig);
       return RestResultBuilder.builder().success().build();
   }

    @GetMapping("/activity-group/config/detail")
    public RestResult detail(){
        return RestResultBuilder.builder().success().data(competitionConfigService.detail()).build();
    }

    @PostMapping("/activity-group/carousel/save")
    public RestResult saveCarousel(@RequestBody CompetitionCarousel competitionCarousel){
        competitionCarouselService.save(competitionCarousel);
        return RestResultBuilder.builder().success().build();
    }

    @GetMapping("/activity-group/carousel/detail")
    public RestResult detail(@RequestParam String id){
        return RestResultBuilder.builder().success().data(competitionCarouselService.detail(id)).build();
    }

    @GetMapping("/activity-group/carousel/list")
    public RestResult list(){
        return RestResultBuilder.builder().success().data(competitionCarouselService.list()).build();
    }

}
